﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI.WebControls;

/// <summary>
///ArrayFormField 的摘要说明
/// </summary>
public class ArrayFormField:BaseFormShow
{
	public ArrayFormField()
	{
		//
		//TODO: 在此处添加构造函数逻辑
		//
	}

    public override IEnumerable<System.Web.UI.Control> GetFieldContrls(System.Reflection.PropertyInfo propertyInfo, object value)
    {
        TextBox field = new TextBox();
        field.ID = propertyInfo.Name;

        if (value != null)
        {
            Array arry = value as Array;
            if (arry != null)
            {
                foreach (object o in arry)
                {
                    if (!string.IsNullOrEmpty(field.Text))
                    {
                        field.Text += ",";
                    }                    
                    field.Text += o.ToString();
                    
                }
            }
        }

        yield return field;
    }

    public override object GetValue(System.Reflection.PropertyInfo propertyInfo, string value)
    {        
        return value.TrimSplit();
    }
}
